package fire.combat;

import fire.Main;
import fire.button.Button;

public class AttackButton extends Button {

	private CombatPet player;
	private CombatPet enemy;
	private boolean isTurn = true;

	public AttackButton(CombatPet player, CombatPet enemy) {
		super("attack", 200, 200, 235, "attack");
		this.player = player;
		this.enemy = enemy;
		setResumeMode(false);
	}

	@Override
	public void mouseInside() {

	}

	@Override
	public void mouseOutside() {

	}

	@Override
	public void leftClick() {
		if (isTurn) {
			player.attack(player, enemy);
			isTurn = false;
		}
	}

	@Override
	public void middleClick() {

	}

	@Override
	public void rightClick() {

	}

	public boolean isTurn() {
		return isTurn;
	}

	public void setTurn(boolean isTurn) {
		this.isTurn = isTurn;
	}

	@Override
	public void move() {
		super.move();
		System.out.println("vao day");
		if (player.getPet().getHp() < 0) {
			CombatMap.lose();
		}
		if (enemy.getPet().getHp() < 0) {
			CombatMap.win();
		}
	}

}
